This invention refers to a method for automatically measuring the opening of an aerosol container in a continuous process, in which a piece known as a cup is inserted, which holds the dispensing valve, and with interior or exterior plastic deformation by mechanical means taking place so that said plastic deformation causes a sealed closure withstanding the pressure contained inside the container after this has been filled with the relevant product. This invention also extends to a device which puts this method into practice.